package code.c02_list.homework;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/9/15 19:16
 * @package code.c02_list.homework
 * @description 文件说明
 */

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n, m;
        while (true) {
            // 输入 m 和 n 的值
            n = scanner.nextInt();
            m = scanner.nextInt();

            // 判断 m 和 n 是否为0
            if (n == 0 && m == 0) {
                System.exit(0);
            }

             ArrayList<Integer> arr =new ArrayList<>(n+1);

            // 为顺序表赋值
            for (int i = 0; i < n; i++) {
                arr.add(scanner.nextInt());
            }
            arr.add(m);

            // 排序操作
            Collections.sort(arr);

            for (Integer a : arr) {
                System.out.print(a + " ");
            }
        }

    }
}
